<!DOCTYPE html>
<html>
<head>
<title>异常的捕获与处理_2</title>

<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">

<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->

</head>

<body>

	<input type="text" id="scanf">
	<input type="button" value="按钮" onclick="demo()">

	<script>
		function demo() {
			try {
				var e = document.getElementById("scanf").value;
				if (e == "") {
					throw "输入框为空";
				}
			} catch (err) {
				alert(err);
			}
		}
	</script>
</body>
</html>
